<template>
  <el-dialog :title="$t('query.event.connectInfo')" width="35%" :visible.sync="connectInfoVisible">
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.deviceCode')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="connectData.deviceId"></div></el-col>
    </el-row>
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.recordTime')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="parseTime(connectData.recordTime)"></div></el-col>
    </el-row>
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.deviceTime')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="parseTime(connectData.deviceTime)"></div></el-col>
    </el-row>
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.event.connectData.status')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="loginStatusFormat(connectData.status)"></div></el-col>
    </el-row>

    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.event.connectData.protocolVersion')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="connectData.protocolVersion"></div></el-col>
    </el-row>
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.event.connectData.mcuHardwareVersion')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="connectData.mcuHardwareVersion"></div></el-col>
    </el-row>
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.event.connectData.mcuSoftwareVersion')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="connectData.mcuSoftwareVersion"></div></el-col>
    </el-row>
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.event.connectData.modemHardwareVersion')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="connectData.modemHardwareVersion"></div></el-col>
    </el-row>
    <el-row>
      <el-col :span="12"><div class="dialog-left-text grid-content">{{$t('query.event.connectData.modemSoftwareVersion')}}</div></el-col>
      <el-col :span="12"><div class="grid-content" v-text="connectData.modemSoftwareVersion"></div></el-col>
    </el-row>
  </el-dialog>
</template>

<script>
export default {
  name: 'connect',
  data() {
    return {
      connectData: {
        deviceId: null,
        deviceType: null,
        recordTime: null,
        deviceTime: null,
        status: null,
        reason: null,
        protocolVersion: null,
        mcuHardwareVersion: null,
        mcuSoftwareVersion: null,
        modemHardwareVersion: null,
        modemSoftwareVersion: null,
      },
      connectInfoVisible: false,

    }
  },

  methods: {
    init(data) {
      this.connectData = data
      this.connectInfoVisible = true
    },

    loginStatusFormat(data) {
      switch (data) {
        case 1:
          return this.$t('query.event.connectData.login')
        case 2:
          return this.$t('query.event.connectData.logout')
        default:
          return data
      }
    },

  }
}
</script>

<style lang="scss" scoped>
.dialog-left-text {
  padding-left: 50px;
  font-weight: bold;
  font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
}
.el-row {
  margin-bottom: 20px;
  &:last-child {
     margin-bottom: 0;
   }
}
.el-col {
  border-radius: 4px;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
}
</style>
